From 44c98ffac2fd6ebeabcc6e4b410bc559358141e9 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 20 Nov 2007 12:11:05 +0000 Subject: [PATCH] * Do not present an image bigger than the source when 'frameless' option is used * This is consistent with the 'thumb' option now: ** Unchanged: [[Image:xyz.jpg|thumb]], [[Image:xyz.jpg|thumb|200px]] do not blow up an image larger than the source ** Unchanged: [[Image:xyz.jpg|frameless]] does not blow up an image ** New: [[Image:xyz.jpg|frameless|200px]] does not blow up an image ** Unchanged: [[Image:xyz.jpg|200px]] still blows up an image --- RELEASE-NOTES | 2 ++ includes/Linker.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fe952aa913..c6ec6488a3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -173,6 +173,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Ensure that rate-limiting is applied to rollbacks. * Make a better rate-limiting error message (i.e. a normal MW error, rather than an "Internal Server Error"). +* Do not present an image bigger than the source when 'frameless' option is used + (to be consistent with the 'thumb' option now) == Parser changes in 1.12 == diff --git a/includes/Linker.php b/includes/Linker.php index 94f6b05c10..9e38a41f42 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -555,6 +555,15 @@ class Linker { return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp ).$postfix; } + if ( $file && isset( $fp['frameless'] ) ) { + $srcWidth = $file->getWidth( $page ); + # For "frameless" option: do not present an image bigger than the source (for bitmap-style images) + # This is the same behaviour as the "thumb" option does it already. + if ( $srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth ) { + $hp['width'] = $srcWidth; + } + } + if ( $file && $hp['width'] ) { # Create a resized image, without the additional thumbnail features $thumb = $file->transform( $hp ); @@ -1379,7 +1388,3 @@ class Linker { return $out; } } - - - - -- 2.20.1